<!DOCTYPE HTML>
<html>

<head>
      <meta charset="utf-8">
      <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
      <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
      <title>Hello APP</title>
      <link rel="stylesheet" type="text/css" href="../css/api.css" />

    <style>
    body{
      padding-top:1.5rem;
    }
  #header{
    width:100%;
    font-size: 1.1rem;

    background: white;

    margin-top:1rem;
    padding-bottom: 0.5rem;
    display: flex;
    align-items: center;




  }
  #header img{
    width:1rem;
    height: 1rem;
    margin-right: 8.1rem;
    margin-left: 0.8rem;


  }

.main{
  width: 100%;
  height: 100%;
  /*background-color: rgb(200, 200, 200, 0.3);*/

}
.cont_top{
  width: 93%;
  height: 4.5rem;
padding: 0.5rem 0.8rem;
border-bottom: 1px solid rgb(243,243,243,0.5)

}
.cont_p{
  width: 30%;
  height: 3.5rem;
  line-height:3.5rem;
  margin-left: 0.5rem;
  margin-top: 0.5rem;
}
.cont_img{
  width: 17%;
  height: 80%;
    margin-top: 0.5rem;
}
.cont_img img{
  width: 100%;
  height: 100%;
}
.cont_imgs{
  width: 4rem;
  height: 2rem;
  margin-top: 1.3rem;
  background-color: rgb(243,243,243,0.5);
  color: #A8A8A8;
  text-align: center;
  line-height: 2rem;
  border-radius: 0.5rem;
}
.fl{
  float:left;
}
.fr{
  float: right;
}

    </style>


</head>

<body>


<div id="header">

      <img src="../image/u18.png" onclick="closewin()">
      关注
</div>
<div class="main" id="userlist">
  <!-- <div class="cont_top">
    <div class="cont_img fl">
      <img src="../image/aa17.png" alt="">
    </div>
    <div class="cont_p fl">
      <p style="">Angle</p>
    </div>
    <div class="cont_imgs fr">
      已关注
    </div>
  </div> -->

</div>
</body>

<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" src="../script/jquery-1.8.3.js"></script>

<script>
var userinfo = $api.getStorage('userinfo');
var page = 1;
var pagesize=20
var ok = true
apiready = function() {
  get_list()
  api.addEventListener({
       　　name:'scrolltobottom',
           extra:{threshold:0}
       }, function(ret, err){
　　　　　　get_list()
      });
}

function get_list() {
  if(ok==false){
    return false
  }
  var html =''
  var obj = $api.byId('userlist');

  api.ajax({
      url: SITE_URL+'user_api/user/myfo',
      method: 'post',
      data: {
          values: {
              user_id: userinfo.id,
              page:page,
              pagesize:pagesize,
              type:1
          }
      }
  },function(ret, err){
      if (ret) {
        if(ret.error==200){
          for (var i = 0; i < ret.data.length; i++) {
            var dat = ret.data[i]
            html +='<div class="cont_top" id="qx'+dat.id+'">'
              html +='<div class="cont_img fl">'
                html +='<img src="'+dat.head_img+'" alt="">'
              html +='</div>'
              html +='<div class="cont_p fl">'
                html +='<p style="">'+cutstr(dat.nick_name,20)+'</p>'
              html +='</div>'
              html +='<div class="cont_imgs fr" onclick="qxgz('+dat.id+')">已关注</div>'
              html +='</div>'
          }
          $api.append(obj, html);
          page+=1

        }else{
          ok = false
          msgcode('您还没有关注任何人')
        }
          //alert( JSON.stringify( ret ) );
      } else {
        msgcode('请检查网络连接')
      //    alert( JSON.stringify( err ) );
      }
  });

}

function qxgz(id) {

  api.ajax({
      url: SITE_URL+'user_api/user/qxgz',
      method: 'post',
      data: {
          values: {
              uid: userinfo.id,
              tid:id
          }
      }
  },function(ret, err){
      if (ret) {
        if(ret.error==200){
          msgcode('取消关注成功')
          $("#qx"+id).remove()
        }else{
          msgcode('取消关注失败')
        }
          //alert( JSON.stringify( ret ) );
      } else {
        msgcode('请检查网络连接')
          //alert( JSON.stringify( err ) );
      }
  });

}

</script>











</html>
